package cn.sdc.bugKiller.dao;

import java.util.List;

import cn.sdc.bugKiller.bean.CodeBean;

public class CodeDaoImpl extends BaseDao {

	public CodeBean getCodeById(Integer id, String codeTblName, Class beanClass){
		String sql = "select * from " + codeTblName
					+" where id= ?/*id*/ ";
				;
		CodeBean cd = (CodeBean)dbutil.doSelectBean(
						beanClass,
						sql,
						new Object[]{id},
						new Class[]{Integer.class});
		return cd;
	}
	
	public List<CodeBean> getAllCode(String codeTblName, Class beanClass){
		String sql = "select id, name from " + codeTblName +" order by id";
		return (List<CodeBean>)dbutil.doSelectBeanList(
									beanClass,
									sql);
	}
	
	public List<CodeBean> getAllCode(String codeTblName){
		return getAllCode(codeTblName,CodeBean.class);
	}
	
}
